<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>注册</title>
    <style>
        body {
            background-image: url('p1.png');
            background-size: cover;
            background-position: center;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            color: #333;
            text-align: center;
        }


        form {
            width: 300px;
            margin: 200px auto;
            background-color: rgba(0, 0, 0, 0.3);
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        input[type="text"] {
            width: 100%;
            padding: 10px;
            margin-bottom: 10px;
            border: 1px solid #ccc;
            border-radius: 3px;
        }

        input[type="submit"] {
            background-color: #ff6347;
            color: #fff;
            border: none;
            padding: 10px 20px;
            border-radius: 3px;
            cursor: pointer;
        }

        input[type="submit"]:hover {
            background-color: #ff4500;
        }
    </style>
    <script>
        function validateForm() {
            var username = document.forms["registrationForm"]["username"].value;
            var password = document.forms["registrationForm"]["userpwd"].value;
            var passwordRegex = /^(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z\d]{6,18}$/;

            if (username == "" || password == "") {
                alert("用户名和密码不能为空");
                return false;
            } else if (!passwordRegex.test(password)) {
                alert("密码需要以大小写字母或数字开头的6~18位字符串");
                return false;
            }
        }


    </script>
</head>
<body>
<form method="post" action="zc.jsp" name="registrationForm" onsubmit="return validateForm()">
    输入用户名：<input type="text" name="username"><br>
    输入密码：<input type="text" name="userpwd"><br>
    确认密码：<input type="text" name="cuserpwd"><br>
    <input type="submit" value="注册">
</form>
</body>
</html>